﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WeiBo.Filter
{
    public class CheckLoginAttribute : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //判断用户是否登录，如果登录跳转到用户信息
            //如果用户没有登录则重新定向到登录页
            if (HttpContext.Current.Session["LUser"] == null)
            {
                filterContext.Result = new RedirectResult("/Music/MusicIndex");
            }
        }
    }
}